﻿using System;
using System.Collections.Generic;
using Olemas.DataModels;
using Olemas.Models;

namespace Olemas.ViewModels
{
    /// <summary>
    /// ViewModel for the commenting functionality
    /// </summary>
    public class CommentsViewModel : GlobalViewModel
    {
        public IEnumerable<Comment> Comments { get; private set; }
        public int CommentItemId { get; private set; }
        public int CommentItemType { get; private set; }
        public CommentModel CommentModel { get; private set; }

        /// <param name="comments">Comments from the database</param>
        /// <param name="totalPages">Total number of pages for the comments</param>
        /// <param name="itemId">The Id of the material the comment belongs to</param>
        /// <param name="itemTypeId">The type of the material(book=1,conspect=2,test=3)</param>
        /// <param name="currentPage">The number of current page of comments</param>
        /// <param name="pagesRemaining">The amount of pages left to load.</param>
        public CommentsViewModel(IEnumerable<Comment> comments, int totalPages, int itemId, int itemTypeId, int currentPage, string pagesRemaining)
        {
            this.Comments = comments;
            this.NumberOfPages = totalPages;
            this.CommentItemId = itemId;
            this.CommentItemType = itemTypeId;
            this.CurrentPage = currentPage;
            this.PagesRemaining = pagesRemaining;
            this.CommentModel = new CommentModel();
        }

    }
}